﻿using System.Collections.Generic;
using System.Linq;
using RSteel.DAL;
using RSteel.DAO;

namespace RSteel.DAO
{
    public class TenderDao : BaseDaoContext<Tender>
    {
        protected TenderDao()
        {
        }

        #region Singelton

        protected static TenderDao instance;

        public static TenderDao Instance
        {
            get
            {
                if (instance == null)
                {
                    instance = new TenderDao();
                }
                return instance;
            }
        }

        #endregion


        public List<Tender> GetObjects(int count)
        {
            using (var dc = GetDataContext())
            {
                List<Tender> tenders = dc.Tenders.Take(count).ToList();
                return tenders;
            }
        }

        public int GetObjectCount()
        {
            using (var dc = GetDataContext())
            {
                return dc.Tenders.Count();
            }
        }
    }
}